package cn.stylefeng.guns.core.util;

import lombok.Getter;

import java.util.Map;

/**
 * liyong
 */
@Getter
public enum ResultStatusEnum {
    FAILURE(0),
    SUCCESS(1);

    private int code;

    ResultStatusEnum(int code) {
        this.code = code;
    }

    public static Map<String, Object> putSuccessCode(Map<String, Object> map) {
        map.put("success", SUCCESS.code);
        return map;
    }


    public static Map<String, Object> putSuccessMsg(Map<String, Object> map, String msg) {
        map.put("success", SUCCESS.code);
        map.put("message", msg);
        return map;
    }

    public static Map<String, Object> putFailureCode(Map<String, Object> map) {
        map.put("success", FAILURE.code);
        return map;
    }

    public static Map<String, Object> putFailureMsg(Map<String, Object> map, String msg) {
        map.put("success", FAILURE.code);
        map.put("message", msg);
        return map;
    }

    public static Map<String, Object> putMsgAndCode(Map<String, Object> map,int code, String msg) {
        map.put("success", code);
        map.put("message", msg);
        return map;
    }

    public int getCode() {
        return code;
    }
}
